package com.icesoft.system.vo;

import com.icesoft.framework.core.binding.annotation.BindDict;
import com.icesoft.framework.core.binding.annotation.BindEntity;
import com.icesoft.framework.core.binding.annotation.BindEntityList;
import com.icesoft.framework.core.binding.annotation.BindField;
import com.icesoft.system.entity.*;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.util.List;

@Getter
@Setter
@Accessors(chain = true)
public class UserVO extends User {

	private String username;

	@BindDict(type = "GENDER_TYPE")
	private String sexLabel;

	@BindEntityList(entity = Account.class, condition = "this.id=user_id")
	private List<Account> accountList;

	@BindEntity(entity = Org.class, condition = "this.org_id=id")
	private Org org;

	@BindEntity(entity = Company.class, condition = "this.company_id=id")
	private Company company;

	@BindEntity(entity = Role.class, condition = "this.id=sys_user_role.user_id and sys_user_role.role_id=id", deepBind = true)
	private RoleVO role;

	@BindField(entity = UserRole.class, field = "roleId", condition = "this.id=user_id")
	private String roleId;

}